Optimal. Leaf size=112 \[ -\left (\left (2 a b B+a^2 C-b^2 C\right ) x\right )-\frac {\left (a^2 B-b^2 B-2 a b C\right ) \log (\cos (c+d x))}{d}+\frac {b (a B-b C) \tan (c+d x)}{d}+\frac {B (a+b \tan (c+d x))^2}{2 d}+\frac {C (a+b \tan (c+d x))^3}{3 b d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.08, antiderivative size = 112, normalized size of antiderivative = 1.00, number of steps
used = 4, number of rules used = 4, integrand size = 32, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.125, Rules used = {3711, 3609,
3606, 3556} \begin {gather*} -\frac {\left (a^2 B-2 a b C-b^2 B\right ) \log (\cos (c+d x))}{d}-x \left (a^2 C+2 a b B-b^2 C\right )+\frac {b (a B-b C) \tan (c+d x)}{d}+\frac {B (a+b \tan (c+d x))^2}{2 d}+\frac {C (a+b \tan (c+d x))^3}{3 b d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 3556
Rule 3606
Rule 3609
Rule 3711
Rubi steps
\begin {align*} \int (a+b \tan (c+d x))^2 \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx &=\frac {C (a+b \tan (c+d x))^3}{3 b d}+\int (a+b \tan (c+d x))^2 (-C+B \tan (c+d x)) \, dx\\ &=\frac {B (a+b \tan (c+d x))^2}{2 d}+\frac {C (a+b \tan (c+d x))^3}{3 b d}+\int (a+b \tan (c+d x)) (-b B-a C+(a B-b C) \tan (c+d x)) \, dx\\ &=-\left (2 a b B+a^2 C-b^2 C\right ) x+\frac {b (a B-b C) \tan (c+d x)}{d}+\frac {B (a+b \tan (c+d x))^2}{2 d}+\frac {C (a+b \tan (c+d x))^3}{3 b d}+\left (a^2 B-b^2 B-2 a b C\right ) \int \tan (c+d x) \, dx\\ &=-\left (2 a b B+a^2 C-b^2 C\right ) x-\frac {\left (a^2 B-b^2 B-2 a b C\right ) \log (\cos (c+d x))}{d}+\frac {b (a B-b C) \tan (c+d x)}{d}+\frac {B (a+b \tan (c+d x))^2}{2 d}+\frac {C (a+b \tan (c+d x))^3}{3 b d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains complex when optimal does not.
time = 1.25, size = 172, normalized size = 1.54 \begin {gather*} \frac {2 C (a+b \tan (c+d x))^3+3 (a B+b C) \left (i \left ((a+i b)^2 \log (i-\tan (c+d x))-(a-i b)^2 \log (i+\tan (c+d x))\right )-2 b^2 \tan (c+d x)\right )+3 B \left ((i a-b)^3 \log (i-\tan (c+d x))-(i a+b)^3 \log (i+\tan (c+d x))+6 a b^2 \tan (c+d x)+b^3 \tan ^2(c+d x)\right )}{6 b d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.07, size = 135, normalized size = 1.21
method | result | size |
norman | \(\left (-2 B a b -C \,a^{2}+b^{2} C \right ) x +\frac {\left (2 B a b +C \,a^{2}-b^{2} C \right ) \tan \left (d x +c \right )}{d}+\frac {b \left (B b +2 C a \right ) \left (\tan ^{2}\left (d x +c \right )\right )}{2 d}+\frac {b^{2} C \left (\tan ^{3}\left (d x +c \right )\right )}{3 d}+\frac {\left (a^{2} B -b^{2} B -2 C a b \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d}\) | \(120\) |
derivativedivides | \(\frac {\frac {b^{2} C \left (\tan ^{3}\left (d x +c \right )\right )}{3}+\frac {B \,b^{2} \left (\tan ^{2}\left (d x +c \right )\right )}{2}+C a b \left (\tan ^{2}\left (d x +c \right )\right )+2 B a b \tan \left (d x +c \right )+C \,a^{2} \tan \left (d x +c \right )-b^{2} C \tan \left (d x +c \right )+\frac {\left (a^{2} B -b^{2} B -2 C a b \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (-2 B a b -C \,a^{2}+b^{2} C \right ) \arctan \left (\tan \left (d x +c \right )\right )}{d}\) | \(135\) |
default | \(\frac {\frac {b^{2} C \left (\tan ^{3}\left (d x +c \right )\right )}{3}+\frac {B \,b^{2} \left (\tan ^{2}\left (d x +c \right )\right )}{2}+C a b \left (\tan ^{2}\left (d x +c \right )\right )+2 B a b \tan \left (d x +c \right )+C \,a^{2} \tan \left (d x +c \right )-b^{2} C \tan \left (d x +c \right )+\frac {\left (a^{2} B -b^{2} B -2 C a b \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (-2 B a b -C \,a^{2}+b^{2} C \right ) \arctan \left (\tan \left (d x +c \right )\right )}{d}\) | \(135\) |
risch | \(-\frac {4 i C a b c}{d}-i B \,b^{2} x +\frac {2 i B \,a^{2} c}{d}-2 B a b x -C \,a^{2} x +C \,b^{2} x +i B \,a^{2} x +\frac {2 i \left (-3 i B \,b^{2} {\mathrm e}^{4 i \left (d x +c \right )}-6 i C a b \,{\mathrm e}^{4 i \left (d x +c \right )}+6 B a b \,{\mathrm e}^{4 i \left (d x +c \right )}+3 C \,a^{2} {\mathrm e}^{4 i \left (d x +c \right )}-6 C \,b^{2} {\mathrm e}^{4 i \left (d x +c \right )}-3 i B \,b^{2} {\mathrm e}^{2 i \left (d x +c \right )}-6 i C a b \,{\mathrm e}^{2 i \left (d x +c \right )}+12 B a b \,{\mathrm e}^{2 i \left (d x +c \right )}+6 C \,a^{2} {\mathrm e}^{2 i \left (d x +c \right )}-6 C \,b^{2} {\mathrm e}^{2 i \left (d x +c \right )}+6 B a b +3 C \,a^{2}-4 b^{2} C \right )}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{3}}-\frac {2 i B \,b^{2} c}{d}-2 i C a b x -\frac {a^{2} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) B}{d}+\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) b^{2} B}{d}+\frac {2 \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) C a b}{d}\) | \(324\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.51, size = 120, normalized size = 1.07 \begin {gather*} \frac {2 \, C b^{2} \tan \left (d x + c\right )^{3} + 3 \, {\left (2 \, C a b + B b^{2}\right )} \tan \left (d x + c\right )^{2} - 6 \, {\left (C a^{2} + 2 \, B a b - C b^{2}\right )} {\left (d x + c\right )} + 3 \, {\left (B a^{2} - 2 \, C a b - B b^{2}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 6 \, {\left (C a^{2} + 2 \, B a b - C b^{2}\right )} \tan \left (d x + c\right )}{6 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 1.37, size = 119, normalized size = 1.06 \begin {gather*} \frac {2 \, C b^{2} \tan \left (d x + c\right )^{3} - 6 \, {\left (C a^{2} + 2 \, B a b - C b^{2}\right )} d x + 3 \, {\left (2 \, C a b + B b^{2}\right )} \tan \left (d x + c\right )^{2} - 3 \, {\left (B a^{2} - 2 \, C a b - B b^{2}\right )} \log \left (\frac {1}{\tan \left (d x + c\right )^{2} + 1}\right ) + 6 \, {\left (C a^{2} + 2 \, B a b - C b^{2}\right )} \tan \left (d x + c\right )}{6 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A]
time = 0.13, size = 194, normalized size = 1.73 \begin {gather*} \begin {cases} \frac {B a^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} - 2 B a b x + \frac {2 B a b \tan {\left (c + d x \right )}}{d} - \frac {B b^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {B b^{2} \tan ^{2}{\left (c + d x \right )}}{2 d} - C a^{2} x + \frac {C a^{2} \tan {\left (c + d x \right )}}{d} - \frac {C a b \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{d} + \frac {C a b \tan ^{2}{\left (c + d x \right )}}{d} + C b^{2} x + \frac {C b^{2} \tan ^{3}{\left (c + d x \right )}}{3 d} - \frac {C b^{2} \tan {\left (c + d x \right )}}{d} & \text {for}\: d \neq 0 \\x \left (a + b \tan {\left (c \right )}\right )^{2} \left (B \tan {\left (c \right )} + C \tan ^{2}{\left (c \right )}\right ) & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 1509 vs.
\(2 (108) = 216\).
time = 1.25, size = 1509, normalized size = 13.47 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 8.80, size = 121, normalized size = 1.08 \begin {gather*} \frac {{\mathrm {tan}\left (c+d\,x\right )}^2\,\left (\frac {B\,b^2}{2}+C\,a\,b\right )}{d}-x\,\left (C\,a^2+2\,B\,a\,b-C\,b^2\right )+\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (C\,a^2+2\,B\,a\,b-C\,b^2\right )}{d}-\frac {\ln \left ({\mathrm {tan}\left (c+d\,x\right )}^2+1\right )\,\left (-\frac {B\,a^2}{2}+C\,a\,b+\frac {B\,b^2}{2}\right )}{d}+\frac {C\,b^2\,{\mathrm {tan}\left (c+d\,x\right )}^3}{3\,d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________